/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package utilidades;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *Formateador de Fechas
 * @author zeta
 */
public class FormatDateString {

    /**
     * Convierte un Date a String dd/MM/yyyy
     * @param date
     * @return
     */
    public static String deDateString(Date date){
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
        return sdf.format(date).toString();
    }

    /**
     * Convierte un String dd/MM/yyyy a Date
     * @param date
     * @return
     */
    public static Date deStringDate(String date){
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
        try {
            return sdf.parse(date);
        } catch (ParseException ex) {
            Logger.getLogger(FormatDateString.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

}
